
//
//  CommonUtil.m
//  WheatPlan
//
//  Created by Billy on 15/7/23.
//  Copyright (c) 2015年 IOSTeam. All rights reserved.
//

#import "CommonUtil.h"

@implementation CommonUtil

+ (void) setDefaultBaby:(Baby *)baby {
    
    [[NSUserDefaults standardUserDefaults] setObject:baby.baby_age forKey:@"babyAge"];
    [[NSUserDefaults standardUserDefaults] setObject:baby.baby_id forKey:@"babyId"];
    [[NSUserDefaults standardUserDefaults] setObject:baby.baby_height forKey:@"babyHeight"];
    [[NSUserDefaults standardUserDefaults] setObject:baby.baby_weight forKey:@"babyWeight"];
    [[NSUserDefaults standardUserDefaults] setObject:baby.baby_name forKey:@"babyName"];
}
+ (NSString*)dictionaryToJson:(NSDictionary *)dic

{
    
    NSError *parseError = nil;
    
    NSData *jsonData = [NSJSONSerialization dataWithJSONObject:dic options:NULL error:&parseError];
    
   
    

    return [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding];
}

@end
